package view;

import javax.microedition.midlet.MIDlet;

import util.MoneyControlConstants;

import com.sun.lwuit.Button;
import com.sun.lwuit.Command;
import com.sun.lwuit.Container;
import com.sun.lwuit.Form;
import com.sun.lwuit.layouts.BorderLayout;

import controller.BankHandler;

public class ManageBanks extends Form
{

	private MIDlet midlet;
	private BankHandler handler;
	
	public ManageBanks(MIDlet m)
	{
		this.midlet = m;
		this.handler = new BankHandler(this.midlet);
		
		Button add = new Button("Adicionar");
		add.addActionListener(this.handler);
		
		Button remove = new Button("Remover");
		remove.addActionListener(this.handler);
		
		Button edit = new Button("Editar");
		edit.addActionListener(this.handler);
		
		Command menu = new Command(MoneyControlConstants.TEXT_COMMAND_MENU);
		Command exit = new Command(MoneyControlConstants.TEXT_COMMAND_SAIR);		
		
		Container c = new Container();
		c.addComponent(add);
		c.addComponent(remove);
		c.addComponent(edit);

		this.setLayout(new BorderLayout());
		this.addComponent(BorderLayout.SOUTH,c);
		//this.addComponent(BorderLayout.NORTH,null);

		this.addCommand(menu);
		this.addCommand(exit);
		
		this.setCommandListener(this.handler);		
		this.show();
	}

	public MIDlet getMidlet()
	{
		return midlet;
	}

	public void setMidlet(MIDlet midlet)
	{
		this.midlet = midlet;
	}

	public BankHandler getHandler()
	{
		return handler;
	}

	public void setHandler(BankHandler handler)
	{
		this.handler = handler;
	}

	
}
